/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.testis.orm.dynamicmap.validation;

import org.testis.orm.refinedclasses.DynamicMapDesignTreeNode;

/**
 * 
 * @author nurhat
 */
public class ValidateUIObject extends IValidateDynamicMapNode {

    public void validate(DynamicMapDesignTreeNode node,
	    DynamicMapDesignTreeNode root) {
	if (node.getObject().getGroupName().equals("Behaviour")) {
	    return;
	}
	if (!node.getObject().getTypeName().equals("UIDeviceMapContainer")) {
	    validateParameter("AbstractId", node, node, "", true);
	    validateParameter("Id", node, node, "", true);
	}
	DynamicMapDesignTreeNode parentNode = node.getParent();
	if (parentNode != null) {
	    if (parentNode.getObject().getTypeName().equals("UIDynamicGrid")) {
		validateParameter("IsDynamic", node, "1", true);
	    }
	}
	validateAbstractIdPostFix(node);
	validateParameterValueUniqueness(node, root, "AbstractId");
	validateParameterValueUniqueness(node, root, "Id");
    }
}
